{% extends "base.html" %}

{% block title %}Delete Unused Chunks{% endblock %}

{% block content %}
<h1>Delete Unused Chunks</h1>

<table>
<tr>
<td style="text-align:right">Found {{ chunks|length }} chunks</td>
<td>from {% with chunks|first as chunk %}{{ chunk.name }}{% endwith %}</td>
<td>to {% with chunks|last as chunk %}{{ chunk.name }}{% endwith %}</td>
</tr>
<tr>
<td style="text-align:right">and {{ blobs|length }} blobs</td>
<td>from {% with blobs|first as blob %}{{ blob.sha1 }}{% endwith %}</td>
<td>to {% with blobs|last as blob %}{{ blob.sha1 }}{% endwith %}.</td>
</tr>
</table>

{% if chunks_without_blobs %}
<h2>{{ chunks_without_blobs|length}} Chunks without Blobs</h2>

<form method="post">
<p><input type="submit" name="confirmed" value="Delete" /></p>
</form>

<ul>
{% for chunk_key in chunks_without_blobs %}
<li><a href="/chunks/{{ chunk_key.name }}">{{ chunk_key.name }}</a></li>
{% endfor %}
</ul>
{% endif %}

{% if blobs_without_chunks %}
<h2>{{ blobs_without_chunks|length}} Blobs without Chunks</h2>
<ul>
{% for blob in blobs_without_chunks %}
<li><a href="{{ blob.get_absolute_url }}">{{ blob.sha1 }}</a></li>
{% endfor %}
</ul>
{% endif %}

{% if recovered_chunks %}
<h2>{{ recovered_chunks|length}} Recovered Chunks from Memcache!</h2>
<ul>
{% for chunk_name in recovered_chunks %}
<li><a href="/chunks/{{ chunk_name }}">{{ chunk_name }}</a></li>
{% endfor %}
</ul>

{% endif %}

{% endblock %}
